package com.digital.herbarium.Controller;

import com.digital.herbarium.annotation.CheckToken;
import com.digital.herbarium.Entity.ResponseResult;
import com.digital.herbarium.Entity.SystemInfo;
import com.digital.herbarium.annotation.Log;
import com.digital.herbarium.service.SystemInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/systeminfo")
public class SystemInfoController {

    @Autowired
    SystemInfoService systemInfoService;


    @GetMapping("getSystemInfo")
    @Log("systeminfo")
    public ResponseResult getSystemInfo(SystemInfo systemInfo){
        return ResponseResult.SUCCESS().setData( systemInfoService.getSystemInfo(systemInfo));
    }


    @GetMapping("getManagerSystemInfo")
    @CheckToken()
    @Log("systeminfo")
    public ResponseResult getManagerSystemInfo(SystemInfo systemInfo){
        return ResponseResult.SUCCESS().setData( systemInfoService.getSystemInfo(systemInfo));
    }


    @PostMapping("addSystemInfo")
    @CheckToken()
    public  ResponseResult addSystemInfo(SystemInfo systemInfo){
        systemInfoService.addSystemInfo(systemInfo);
        return ResponseResult.SUCCESS().setData("添加成功");
    }

    @PostMapping("editSystemInfo")
    @CheckToken()
    public  ResponseResult editSystemInfo(SystemInfo systemInfo){
        systemInfoService.editSystemInfo(systemInfo);
        return ResponseResult.SUCCESS().setData("更新成功");
    }

    @GetMapping("delSystemInfo")
    @CheckToken()
    public ResponseResult delSystemInfo(String id){
        systemInfoService.delSystemInfo(id);
        return  ResponseResult.SUCCESS().setData("删除成功");
    }

}
